<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>创建团队管理员</title>

    <!-- 引入Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- 自定义样式 -->
    <style>
        body {
            background-color: #f4f7fc;
            font-family: Arial, sans-serif;
            display: flex;
            min-height: 100vh;
            margin: 0;
        }

        /* 侧边栏样式 */
        .sidebar {
            width: 250px;
            background-color: #007bff;
            color: white;
            height: 100vh;
            position: fixed;
            top: 0;
            left: 0;
            padding-top: 20px;
            box-shadow: 2px 0px 5px rgba(0, 0, 0, 0.1);
        }

        .sidebar h2 {
            text-align: center;
            margin-bottom: 20px;
            font-size: 20px;
        }

        .sidebar a {
            display: block;
            padding: 12px;
            color: white;
            text-decoration: none;
            font-size: 16px;
        }

        .sidebar a:hover {
            background-color: #0056b3;
        }

        /* 页面主内容部分 */
        .main-content {
            margin-left: 250px;
            padding: 20px;
            flex-grow: 1;
        }

        .container {
            max-width: 800px;
            margin-top: 40px;
            padding: 20px;
            background-color: #ffffff;
            border-radius: 8px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        }

        h1 {
            text-align: center;
            color: #007bff;
        }

        .alert-message {
            margin-bottom: 20px;
        }

        .form-label {
            font-weight: 500;
        }

        .form-control {
            border-radius: 0.375rem;
            box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
        }

        .form-control:focus {
            border-color: #007bff;
            box-shadow: 0 0 8px rgba(0, 123, 255, 0.25);
        }

        .btn-custom {
            background-color: #007bff;
            color: white;
            border: none;
            padding: 10px 15px;
            font-size: 1.1rem;
            width: 100%;
            border-radius: 5px;
        }

        .btn-custom:hover {
            background-color: #0056b3;
        }

        .back-link {
            display: inline-block;
            margin-top: 20px;
            text-align: center;
            color: #007bff;
            font-size: 1.1rem;
        }

        .back-link:hover {
            color: #0056b3;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .text-center {
            margin-top: 20px;
        }
    </style>
</head>

<body>
<!-- 侧边栏 -->
<div class="sidebar">
    <h2>超级管理员控制台</h2>
    <a href="/superAdmin/achievementReview">科研成果审核</a>
    <a href="/superAdmin/users">用户管理</a>
    <a href="/superAdmin/permissions/management">权限管理</a>
    <a href="/superAdmin/articleReview">文章审核</a>
    <a href="/logout">退出登录</a>
</div>


<!-- 页面主内容 -->
<div class="main-content">
    <div class="container">
        <h1>创建团队管理员</h1>

        <!-- 显示成功或错误消息 -->
        <c:if test="${not empty message}">
            <div class="alert alert-success alert-message">${message}</div>
        </c:if>

        <form action="<c:url value='/superAdmin/users/create' />" method="post">

            <!-- 用户昵称 -->
            <div class="form-group">
                <label for="nickname" class="form-label">用户昵称：</label>
                <input type="text" id="nickname" name="nickname" class="form-control" required />
            </div>

            <!-- 用户姓名 -->
            <div class="form-group">
                <label for="name" class="form-label">用户姓名：</label>
                <input type="text" id="name" name="name" class="form-control" required />
            </div>

            <!-- 密码 -->
            <div class="form-group">
                <label for="password" class="form-label">密码：</label>
                <input type="password" id="password" name="password" class="form-control" required />
            </div>

            <!-- 邮箱 -->
            <div class="form-group">
                <label for="email" class="form-label">用户邮箱：</label>
                <input type="email" id="email" name="email" class="form-control" required />
            </div>

            <!-- 角色类型 -->
            <div class="form-group">
                <label for="roleType" class="form-label">角色类型：</label>
                <select id="roleType" name="roleType" class="form-control">
                    <option value="0">超级管理员</option>
                    <option value="1">团队管理员</option>
                    <option value="2">团队成员</option>
                    <option value="3">普通用户</option>
                </select>
            </div>

            <!-- 研究方向 -->
            <div class="form-group">
                <label for="researchDirection" class="form-label">研究方向：</label>
                <input type="text" id="researchDirection" name="researchDirection" class="form-control" />
            </div>

            <!-- 申请理由 -->
            <div class="form-group">
                <label for="applicationReason" class="form-label">申请理由：</label>
                <textarea id="applicationReason" name="applicationReason" class="form-control"></textarea>
            </div>

            <!-- 注册时间 (自动填充，服务器端设置) -->
            <input type="hidden" id="registrationTime" name="registrationTime" value="<%= new java.util.Date() %>" />

            <!-- 用户状态 -->
            <div class="form-group">
                <label for="status" class="form-label">用户状态：</label>
                <select name="status" id="status" class="form-control">
                    <option value="1">启用</option>
                    <option value="0">禁用</option>
                </select>
            </div>

            <!-- 联系电话 -->
            <div class="form-group">
                <label for="phoneNumber" class="form-label">用户电话：</label>
                <input type="text" id="phoneNumber" name="phoneNumber" class="form-control" />
            </div>

            <!-- 学术背景 -->
            <div class="form-group">
                <label for="academicBackground" class="form-label">学术背景：</label>
                <input type="text" id="academicBackground" name="academicBackground" class="form-control" />
            </div>

            <!-- 科研成果 -->
            <div class="form-group">
                <label for="researchAchievements" class="form-label">科研成果：</label>
                <input type="text" id="researchAchievements" name="researchAchievements" class="form-control" />
            </div>

            <!-- 职务 -->
            <div class="form-group">
                <label for="jobTitle" class="form-label">职务：</label>
                <input type="text" id="jobTitle" name="jobTitle" class="form-control" />
            </div>

            <!-- 选择团队 -->
            <div class="form-group">
                <label for="team" class="form-label">选择团队：</label>
                <select name="teamId" id="team" class="form-control">
                    <c:forEach var="team" items="${teams}">
                        <option value="${team.teamId}">${team.teamName}</option>
                    </c:forEach>
                </select>
            </div>

            <!-- 提交按钮 -->
            <button type="submit" class="btn btn-custom">创建管理员</button>

        </form>

        <!-- 返回管理员列表链接 -->
        <a href="<c:url value='/superAdmin/users' />" class="back-link">返回管理员列表</a>
    </div>
</div>

<!-- 引入Bootstrap JS 和依赖 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>

</html>
